
import urllib.request

url = 'https://www.baidu.com'
headers={
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"
}

requestObj=urllib.request.Request(url, [],headers)

resp = urllib.request.urlopen(requestObj)
print(resp.read().decode("utf-8"))
